#include "DeaconsWidget.h"

void DeaconsWidget::loadFamily()
{
	family1->setText(QString("%1").arg(m_youth->deacons().family().req1()));
	family2->setText(QString("%1").arg(m_youth->deacons().family().req2()));
	family3->setText(QString("%1").arg(m_youth->deacons().family().req3()));
	family4->setText(QString("%1").arg(m_youth->deacons().family().req4()));
	family5->setText(QString("%1").arg(m_youth->deacons().family().req5()));
	family6->setText(QString("%1").arg(m_youth->deacons().family().req6()));
	family7->setText(QString("%1").arg(m_youth->deacons().family().req7()));
}

void DeaconsWidget::on_family1_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().family().setReq1(percent);
	updateCompletions();
}

void DeaconsWidget::on_family2_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().family().setReq2(percent);
	updateCompletions();
}

void DeaconsWidget::on_family3_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().family().setReq3(percent);
	updateCompletions();
}

void DeaconsWidget::on_family4_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().family().setReq4(percent);
	updateCompletions();
}

void DeaconsWidget::on_family5_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().family().setReq5(percent);
	updateCompletions();
}

void DeaconsWidget::on_family6_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().family().setReq6(percent);
	updateCompletions();
}

void DeaconsWidget::on_family7_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().family().setReq7(percent);
	updateCompletions();
}


